
/* USER CODE BEGIN Header */
/**
  ******************************************************************************
  * @file    temperature_table.h
  * @brief   This file contains temperature table for 100K NTC termistor
  * @author Petar Crnjak
  ******************************************************************************
  * @attention
  *
  * Copyright (c) Source robotics.
  * All rights reserved.
  *
  * This software is licensed under terms that can be found in the LICENSE file
  * in the root directory of this software component.
  * If no LICENSE file comes with this software, it is provided AS-IS.
  *
  ******************************************************************************
  */


/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef _TEMP_TABLE
#define _TEMP_TABLE
#include <Arduino.h>

/***********************************************************************************************************
* This table is generated using this code: https://github.com/PCrnjak/Thermistor-table-generator-using-Steinhart-Hart-equation
* Each index point in this table is tied to specific temperature characteristic to NTC 3950 thermistor.
* Datasheet: https://www.tme.eu/Document/f9d2f5e38227fc1c7d979e546ff51768/NTCM-100K-B3950.pdf
* STM32f103c has 12 bit ADC and table size is 8 bit so we downscale our ADC value after we read it.
************************************************************************************************************/


/// Table using empirical measure
/* 
const int Temp_table[] = {
-72,-72,-61,-54,-49,-45,-41,-38,-36,-33,-31,-29,-28,-26,-24,-23,-22,-20,-19,-18,-17,-16,-15,
-14,-13,-12,-11,-10,-9,-8,-7,-6,-6,-5,-4,-3,-3,-2,-1,-1,0,0,0,1,1,2,3,3,4,4,5,6,6,7,7,8,8,9,
9,10,10,11,11,12,12,13,13,14,14,15,15,16,16,17,17,17,18,18,19,19,20,20,21,21,21,22,22,23,23,
24,24,24,25,25,26,26,26,27,27,28,28,29,29,29,30,30,31,31,31,32,32,33,33,33,34,34,35,35,35,36,
36,37,37,37,38,38,39,39,39,40,40,41,41,42,42,42,43,43,44,44,44,45,45,46,46,47,47,47,48,48,49,
49,50,50,50,51,51,52,52,53,53,54,54,55,55,55,56,56,57,57,58,58,59,59,60,60,61,61,62,62,63,64,
64,65,65,66,66,67,67,68,69,69,70,70,71,72,72,73,74,74,75,76,76,77,78,79,79,80,81,82,82,83,84,
85,86,87,88,89,89,90,91,93,94,95,96,97,98,99,101,102,103,105,106,108,110,111,113,115,117,119,
121,124,126,129,132,136,139,143,148,153,160,167,177,189,208,242};
*/

/// Table using datasheet
/// https://www.tme.eu/Document/f9d2f5e38227fc1c7d979e546ff51768/NTCM-100K-B3950.pdf
const int Temp_table[] = {
-64,-64,-54,-47,-43,-39,-36,-33,-31,-29,-27,-25,-24,-22,-21,-19,-18,-17,-16,-15,-14,-13,-12,-11,
-10,-9,-8,-7,-7,-6,-5,-4,-4,-3,-2,-1,-1,0,0,0,1,1,2,2,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,
13,13,13,14,14,15,15,16,16,17,17,17,18,18,19,19,19,20,20,21,21,22,22,22,23,23,23,24,24,25,25,25,26,
26,27,27,27,28,28,29,29,29,30,30,30,31,31,32,32,32,33,33,33,34,34,35,35,35,36,36,36,37,37,38,38,38,
39,39,40,40,40,41,41,41,42,42,43,43,43,44,44,45,45,45,46,46,47,47,48,48,48,49,49,50,50,50,51,51,52,
52,53,53,54,54,54,55,55,56,56,57,57,58,58,59,59,60,60,61,61,62,62,63,63,64,64,65,66,66,67,67,68,68,
69,70,70,71,72,72,73,73,74,75,76,76,77,78,79,79,80,81,82,83,83,84,85,86,87,88,89,90,91,92,93,95,96,
97,98,100,101,103,104,106,108,109,111,113,115,117,120,122,125,128,132,135,139,144,150,156,164,173,
186,206,242};


#endif 